package edu.uts.reekie.designer.execution.model;

import org.eclipse.draw2d.Graphics;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;

import edu.uts.reekie.designer.model.AbstractConnector;
import edu.uts.reekie.designer.model.ViewNode;

/*
 * 
 * TODO: expose directions as property sheet (combo box - see connections in shapes example)
 * TODO: add labels for decorations
 * TODO: 
 */
public class Connector extends AbstractConnector {

	/*
	 * Connector decorations
	 * 
	 */
	public enum Decoration {
		Async,Sync,Callback;
	}

	public static final String PROPERTY_DECORATION_SOURCE = "Source Decoration";
	public static final String PROPERTY_DECORATION_TARGET= "Target Decoration";
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Connector() {
		
	}
	
	/** 
	 * Create a (solid) connection between two distinct shapes.
	 * @param source a source endpoint for this connection (non null)
	 * @param target a target endpoint for this connection (non null)
	 * @throws IllegalArgumentException if any of the parameters are null or source == target
	 * @see #setLineStyle(int) 
	 */
	public Connector(ViewNode source, ViewNode target) {
		super(source, target);
	}

	
	/**
	 * @param sourceDecoration the sourceDecoration to set
	 */
	public void setSourceDecoration(Decoration sourceDecoration) {
		Decoration oldValue = this.sourceDecoration;
		this.sourceDecoration = sourceDecoration;
		firePropertyChange(PROPERTY_DECORATION_TARGET, oldValue, sourceDecoration);
	}

	/**
	 * @return the sourceDecoration
	 */
	public Decoration getSourceDecoration() {
		return sourceDecoration;
	}


	/**
	 * @param targetDecoration the targetDecoration to set
	 */
	public void setTargetDecoration(Decoration targetDecoration) {
		Decoration oldValue = this.targetDecoration;
		this.targetDecoration = targetDecoration;
		firePropertyChange(PROPERTY_DECORATION_TARGET, oldValue, targetDecoration);
	}

	/**
	 * @return the targetDecoration
	 */
	public Decoration getTargetDecoration() {
		return targetDecoration;
	}


	private Decoration sourceDecoration = Decoration.Sync;
	private Decoration targetDecoration= Decoration.Sync;
	
	
	
}
